<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <?php include 'inc/head.php'; ?>
</head>

<body>
  <?php include 'inc/header.php'; ?>

  <div class="container">

    <?php
    echo form_create(
      ['action' => M('admin', 'channel', 'edit_action', $this->id)],
      [
        ['type' => 'part_start'],
        ['type' => 'text', 'label' => '频道名称', 'key' => 'c_name', 'required' => 'required'],
        ['type' => 'upload_img', 'label' => '频道图片', 'key' => 'c_picture'],
        ['type' => 'select', 'label' => '上级频道', 'key' => 'c_parent', 'value' => '<option value="0">一级频道</option>' . channel_select_list(0, $row['c_parent']), 'html' => true],
        ['type' => 'select', 'label' => '频道模型', 'key' => 'c_cmodel_select', 'value' => channel_model_select_list($row['c_cmodel']), 'html' => true],
        ['type' => 'text', 'label' => '自定义频道模型', 'key' => 'c_cmodel'],
        ['type' => 'select', 'label' => '内容模型', 'key' => 'c_dmodel_select', 'value' => detail_model_select_list($row['c_dmodel']), 'html' => true],
        ['type' => 'text', 'label' => '自定义详情模型', 'key' => 'c_dmodel'],
        ['type' => 'editor', 'label' => '频道详情', 'key' => 'c_content'],
        ['type' => 'editor', 'label' => '频道简介', 'key' => 'c_scontent'],
        ['type' => 'text', 'label' => '分页条数', 'key' => 'c_page', 'value' => 20, 'required' => 'required'],
        ['type' => 'text', 'label' => '排序', 'key' => 'c_order', 'value' => 100, 'required' => 'required'],
        ['type' => 'part_end'],

        ['type' => 'part_start'],
        ['type' => 'radio', 'label' => '导航显示', 'key' => 'c_navigation', 'value' => [
          ['label' => '是', 'value' => 1, 'checked' => 'checked'],
          ['label' => '否', 'value' => 0],
        ]],
        ['type' => 'text', 'label' => '导航名称', 'key' => 'c_nname', 'placeholder' => '留空后自动获取频道名称'],
        ['type' => 'text', 'label' => '链接地址', 'key' => 'c_link', 'placeholder' => '填写后会跳转到指定的地址'],
        ['type' => 'text', 'label' => '简短名称', 'key' => 'c_sname'],
        ['type' => 'text', 'label' => '频道别名', 'key' => 'c_aname'],
        ['type' => 'upload_img', 'label' => '频道封面', 'key' => 'c_cover'],
        ['type' => 'upload_imgs', 'label' => '频道组图', 'key' => 'c_slideshow'],
        ['type' => 'select', 'label' => '打开方式', 'key' => 'c_target', 'value' => [
          ['label' => '本窗口', 'value' => '_self', 'selected' => 'selected'],
          ['label' => '新窗口', 'value' => '_blank'],
        ]],
        ['type' => 'select', 'label' => '防删', 'key' => 'c_safe', 'value' => [
          ['label' => '保护', 'value' => 1],
          ['label' => '自由', 'value' => 0],
        ]],
        ['type' => 'part_end'],

        ['type' => 'part_start'],
        ['type' => 'text', 'label' => '优化标题', 'key' => 'c_seoname'],
        ['type' => 'text', 'label' => '关键字', 'key' => 'c_keywords'],
        ['type' => 'textarea', 'label' => '描述', 'key' => 'c_description'],
        ['type' => 'part_end'],

        ['type' => 'submit', 'label' => '提交', 'key' => 'save'],
      ],
      ['基本', '附属', 'SEO'],
      $row
    );
    ?>

  </div>
  <?php include 'inc/footer.php'; ?>

  <!-- js -->
  <script>
  $(function() {
    $("#c_cmodel_select").change(function() {
      $("#c_cmodel").val($(this).val());
    });
    $("#c_dmodel_select").change(function() {
      $("#c_dmodel").val($(this).val());
    });
  })
  </script>

</body>

</html>
